/*
 * @lc app=leetcode.cn id=1725 lang=javascript
 *
 * [1725] 可以形成最大正方形的矩形数目
 */

// @lc code=start
/**
 * @param {number[][]} rectangles
 * @return {number}
 */
var countGoodRectangles = function (rectangles) {
  let max = 0;
  let sum = 0;
  for (let [l, w] of rectangles) {
    const min = Math.min(l, w);
    if (min > max) {
      sum = 1;
      max = min;
    } else if (min === max) {
      sum++;
    }
  }
  return sum;
};
// @lc code=end

